# Euler Problem 4
# Find the largest palindrome made from the product of two 3-digit numbers.

import math
#################################
cycles = 50000
cycles = 1
import time
c1 = time.clock()
for x in xrange(0xFFFFF): pass
for i in range(cycles):
    answer = 0
#################################
### program calculation start ###
#################################

#    done = 0
#    while not done:
    for i in range(999,100,-1):
        for j in range(999,100,-1):
            product = i * j
            if product > answer:
                strprod = str(product)
                if strprod == strprod[::-1]:
                    answer = product
                    print i, " * ", j, " = ", product

#################################
###  program calculation end  ###
#################################
c2 = time.clock()
if cycles > 1: print "Time spent is %.2f ms" % ((c2-c1)*1000/cycles)
#################################
        
print 'The answer to Problem #4 is >>', answer, '<<'

        